import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:getxdemo/res/string.dart';
import 'package:getxdemo/ui/dialog/dialog_loading.dart';

extension GetExtension on GetInterface {

  void dismissDialog(){
    if (Get.isDialogOpen != null && Get.isDialogOpen!) {
      Get.back();
    }
  }

  void showLoading({String text = ''}) {
    dismissDialog();
    Get.dialog(
      LoadingDialog(text: text),
      barrierDismissible: false,
      transitionDuration: const Duration(milliseconds: 200),
    );
  }
}
